import 'package:ruitmentapp/core/services/http_request.dart';
import 'package:ruitmentapp/personnel/model/zj_home_model.dart';
import 'package:flutter/material.dart';

class ZJHomeRequest {
  static Future<List<ZJHomePositionModel>> postHomePositionData(String type, String cityId, String positionId, String page,String size) async {
    // 1.发送网络请求
    const url = "/client/es/getPosition";
    const method = "post";

    var params = {
      'type' : type,
      'cityId' : cityId,
      'positionId' : positionId,
      'page' : page,
      'size' : size,
    };
    final result = await HttpRequest.request(url, method:method, params: params);

    // 2.json转modal
    final mealArray = result["list"];
    List<ZJHomePositionModel> meals = [];
    for (var json in mealArray) {
      meals.add(ZJHomePositionModel.fromJson(json));
    }
    return meals;
  }
}